/** @method useOperatorData
 *  @description 获取风险类型的数据
 *  @return Array
 */

import { useEffect, useState } from 'react';
import services from '../services/api';

export default function useOperatorData() {
  const [riskTypes, setRiskTypes] = useState([]);

  useEffect(() => {
    getRiskTypeList()
  }, []);

  // 获取风险类型列表
  function getRiskTypeList() {
    services.riskType.all().then((res) => {
      if (res.code === '0') {
        setRiskTypes(res.data);
      }
    });
  }

  return riskTypes;
}
